package com.kasinf.springcloud.alibaba.controller;

import com.kasinf.springcloud.alibaba.domain.Storage;
import com.kasinf.springcloud.alibaba.service.StorageService;
import com.kasinf.springcloud.entity.CommonResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author KAISER
 */
@RestController
@RequestMapping("storage")
public class StorageController {

    @Resource
    private StorageService storageService;

    @RequestMapping("decrease")
    public CommonResult<Storage> decrease(Long productId, Integer count){
        storageService.decrease(productId, count);
        return new CommonResult<>(200, "扣减库存成功");
    }
}
